tests: Skip libarchive/selinux tests if in container without SELinux
authorColin Walters <walters@verbum.org>
Tue, 25 Oct 2016 14:40:45 +0000 (10:40 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 27 Oct 2016 16:48:34 +0000 (16:48 +0000)
I'm doing builds and `make check` inside a Docker container, with
selinux on as a build-time option, but no policy in the container.
This currently aborts.  Let's not do that.

(This type of thing is why installed tests are a better model)

Closes: #546
Approved by: jlebon

tests/test-libarchive-import.c

index 3ef379e31f72b61a07ef02c759a3faf27a6b0f27..ad2e4c94be36785b2190d4b6413de45621902601 100644 (file)
@@ -501,12 +501,10 @@ test_libarchive_selinux (gconstpointer data)
   {
     glnx_unref_object GFile *root = g_file_new_for_path ("/");
 
-    /* creation should always succeed */
-    sepol = ostree_sepolicy_new (root, NULL, &error);
-    g_assert (sepol != NULL);
+    sepol = ostree_sepolicy_new (root, NULL, NULL);
   }
 
-  if (ostree_sepolicy_get_name (sepol) == NULL)
+  if (sepol == NULL || ostree_sepolicy_get_name (sepol) == NULL)
     {
       g_test_skip ("SELinux disabled");
       goto out;